
package com.gxa.controller;

import com.gxa.common.base.LayuiResultJson;
import com.gxa.common.base.Result;
import com.gxa.domain.entity.PayProject;
import com.gxa.service.Impl.PayProjectServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

        import java.util.List;

@Controller
@RequestMapping("/payProject")
public class PayProjectController {

    @Autowired
    PayProjectServiceImpl payProjectService;

    @RequestMapping("/findPayProjectById")
    public PayProject findUserById(int payProjectId) {
        return payProjectService.findPayProjectById(payProjectId);
    }

    //查询所有数据
    @RequestMapping(value = "/queryAllPayProjects", method = RequestMethod.GET)
    @ResponseBody
    public List<PayProject> getAllPayProjects() {
        return payProjectService.queryAll();
    }

    //通过主键更新一个**
    @RequestMapping(value = "/updatePayProject/{id}", method = RequestMethod.PUT)
    @ResponseBody
    public void updatePayProject(@PathVariable Long id, @RequestBody String columnName) {
        payProjectService.updateById(id, columnName);
    }

    //通过一个主键删除一条**记录
//    @RequestMapping(value = "/deletePayProject/{id}", method = RequestMethod.DELETE)
//    @ResponseBody
//    public void deletePayProject(@PathVariable Long id) {
//        payProjectService.deleteById(id);
//    }

    //根据完整记录新增一个**
    @RequestMapping(value = "/insertPayProject", method = RequestMethod.POST)
    @ResponseBody
    public void insertPayProject(@RequestBody PayProject payProject) {
        payProjectService.insert(payProject);
    }

    //列表查询分页
//    @RequestMapping(value = "/ListQueryPagination", method = RequestMethod.GET)
//    @ResponseBody
//    public LayuiResultJson queryPayProjects(@RequestParam("page") int page, @RequestParam("limit") int size) {
//        return payProjectService.queryPayById("",page, size);
//    }
    //列表查询分页
    @RequestMapping(value = "/ListQueryPagination", method = RequestMethod.GET)
    @ResponseBody
    public LayuiResultJson queryPayById( String ename,@RequestParam("page") int page, @RequestParam("limit") int size) {
        System.out.println("ename="+ename+page+size);
        return payProjectService.queryPayById(ename,page,size);
    }

    //根据id数组删除
    @RequestMapping(value = "/queryPayByIds", method = RequestMethod.POST)
    @ResponseBody
    public Result queryPayByIds(@RequestBody List<PayProject> payProjects) {
        System.out.println("payProjects"+payProjects);
        return payProjectService.queryPayByIds(payProjects);
    }
}
